<.settings_tiles>
  <.tile :if={Plausible.Users.type(@current_user) == :standard}>
    <:title>
      <a id="update-name">Your name</a>
    </:title>
    <.form
      :let={f}
      action={Routes.settings_path(@conn, :update_name)}
      for={@name_changeset}
      method="post"
    >
      <.input type="text" field={f[:name]} label="Name" width="w-1/2" mt?={false} />

      <.button type="submit">
        Change name
      </.button>
    </.form>
  </.tile>

  <.tile :if={Plausible.Users.type(@current_user) == :sso}>
    <:title>
      <a id="view-name">Your name</a>
    </:title>
    <.form :let={f} for={@name_changeset}>
      <.input type="text" field={f[:name]} disabled={true} label="Name" width="w-1/2" mt?={false} />
    </.form>
  </.tile>

  <.tile docs="dashboard-appearance">
    <:title>
      <a id="update-theme">Appearance</a>
    </:title>
    <.form
      :let={f}
      action={Routes.settings_path(@conn, :update_theme)}
      for={@theme_changeset}
      method="post"
    >
      <.input
        type="select"
        field={f[:theme]}
        options={Plausible.Themes.options()}
        label="Theme"
        width="w-1/2"
        mt?={false}
      />

      <.button type="submit">
        Change theme
      </.button>
    </.form>
  </.tile>
</.settings_tiles>
